<%@ page import="java.text.SimpleDateFormat" %>
<%@ page import="java.util.Date" %><%--
  Created by IntelliJ IDEA.
  User: asus
  Date: 2019/12/8
  Time: 19:19
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
</head>
<body>
       <%
           session.setAttribute("username","admin");
           session.setAttribute("password","123456");
           session.setAttribute("age","20");
           SimpleDateFormat sdf=new SimpleDateFormat("yyyy年MM月dd日 HH:mm:ss");
           Date d=new Date(session.getCreationTime());
           //设置两次请求的最大间隔时间
           //session.setMaxInactiveInterval(10);  //10秒
           %>
          session创建时间:<%=sdf.format(d)%><br>
          session的ID:<%=session.getId()%><br>
          session的属性值:<%=session.getAttribute("username")%><br>
<a href="session_page2.jsp" target="_blank">测试session的生命周期</a>

</body>
</html>
